package com.wanwan.controller;

import com.wanwan.service.ReptileService;
import entity.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/out")
public class ReptileController {

    @Autowired
    private ReptileService reptileService;

    @RequestMapping("/runreptile")
    @ResponseBody
    public ResultBean runReptile(){
        boolean flag = reptileService.runReptile();
        if (flag) {
            return new ResultBean("年度总结爬取成功");
        }else {
            return new ResultBean("年度总结爬取失败");
        }
    }

    //http://localhost:9001/reptile/out/runreptile/ball
    @RequestMapping("/runreptile/mov")
    @ResponseBody
    public ResultBean runReptileBall(){
        boolean b = reptileService.runReptileBall();
        if (b) {
            return new ResultBean("金句爬取成功");
        }else {
            return new ResultBean("金句爬取失败");
        }
    }
}
